<?php

//format.class.php

//april 9, 2008


class format {

	public static function date($date)
	{
		return date('F j, Y g:i a', $date);
	}
	
	public static function short($string)
	{
		
		$string = self::x2p(stripslashes($string));
		if(strpos($string, '#*#') === FALSE)
		{
			return $string;
		}
		else
		{
			$string = substr($string, 0, strpos($string, '#*#'));
			return $string . '</p>';
		}
	
	}
	
	public static function x2p($string)
	{
		$string = '<p>' . nl2br(preg_replace('#([\r\n]\s*?[\r\n]){2,}#', '</p><p>', $string)) . '</p>';
		return str_replace('</p><p>', '</p>
	<p>', $string);
	}
	
	public static function content($string)
	{
		global $plugins;
		
		foreach($plugins['content'] as $plugin)
		{
			$string = plugin::load($plugin, array($string));
		}
		
		return $string;
	}

}

?>